import os
import pickle
import torch
import seed
import model
import pandas
model = torch.load("save.pkl")
i=0
c = 0
d = 0
e = 0
g = 0
#seed.seed_everything()
bcsv = pandas.read_csv(r"D:\old\Desktop\old\animal\barking-emotion-recognition\data\dataset_2.csv")
for index in range(401,604):
    with torch.no_grad():
        filestr = r"D:/old/Desktop/old/animal/barking-emotion-recognition/data/audioset_audios/" + bcsv["ytid"][
            index] + "_" + str(int(bcsv["start"][index])) + "_" + str(int(bcsv["stop"][index])) + "_cut.mp3"
        try:
            out = model(filestr)
        except FileNotFoundError:
            continue
        model.eval()
        if bcsv["label"][index] == 'Happy':
            label = torch.tensor([1, 0, 0]).float().cuda()
        elif bcsv["label"][index] == 'Aggressive':
            label = torch.tensor([0, 1, 0]).float().cuda()
        else:
            label = torch.tensor([0, 0, 1]).float().cuda()
        a = int(torch.argmax(out))
        b = int(torch.argmax(label))
        print(a, b)
        # print(a)
        if a == b:
            c = c + 1
        if a == 0:
            d = d + 1
        if a == 1:
            e = e + 1
        if a == 2:
            g = g + 1
        # print(torch.
        # input[0].cuda(),input[1])
        i = i + 1
print(c,i)
print(d,e,g)